#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <map>
using namespace std;
#define MAXN 105
#define sz(x) (int)(x.size())

int N, Cas = 1;

struct Point {
	int x, y;
} p[MAXN];

vector<int> xcoor, ycoor;

map<int, int> mx, my;

vector<int> vx[MAXN], vy[MAXN];

void work() {
	xcoor.clear();
	ycoor.clear();
	mx.clear();
	my.clear();
	for (int i = 0; i < MAXN; i ++) vx[i].clear(), vy[i].clear();
	printf("Case %d: ", Cas ++); 
	for (int i = 1; i <= N; i ++) {
		scanf("%d %d", &p[i].x, &p[i].y);
		xcoor.push_back(p[i].x);
		ycoor.push_back(p[i].y);
	}
	sort(xcoor.begin(), xcoor.end());
	xcoor.erase(unique(xcoor.begin(), xcoor.end()), xcoor.end());
	ycoor.erase(unique(ycoor.begin(), ycoor.end()), ycoor.end());
	for (int i = 0; i < sz(xcoor); i ++) {
		mx[xcoor[i]] = i;
	}
	for (int i = 0; i < sz(ycoor); i ++) {
		my[ycoor[i]] = i;
	}
	for (int i = 1; i <= N; i ++) {
		p[i].x = mx[p[i].x];
		p[i].y = my[p[i].y];
		vx[p[i].x].push_back(p[i].y);
		vy[p[i].y].push_back(p[i].x);
	}
	for (int i = 0; i < sz(xcoor); i ++) {
		sort(vx[i].begin(), vx[i].end());
	}
	for (int i = 0; i < sz(ycoor); i ++) {
		sort(vy[i].begin(), vy[i].end());
	}
	if (sz(xcoor) == 1 || sz(ycoor) == 1) {
		cout << N << endl; return ;
	}
	int ans = 0;
	for (int Y1 = 0; Y1 < sz(ycoor); Y1 ++) {
		for (int Y2 = Y1 + 1; Y2 < sz(ycoor); Y2 ++) {
			int pre = 0;
			for (int X = 0; X < sz(xcoor); X ++) {
				int lowx = lower_bound(vx[X].begin(), vx[X].end(), Y1) - vx[X].begin();
				int highx = upper_bound(vx[X].begin(), vx[X].end(), Y2) - vx[X].begin() - 1;
				if (highx >= lowx) {
					int x = highx - lowx + 1;
					int y1Value = lower_bound(vy[Y1].begin(), vy[Y1].end(), X) - vy[Y1].begin() - 1;
					int y2Value = lower_bound(vy[Y2].begin(), vy[Y2].end(), X) - vy[Y2].begin() - 1;
					int now = x + y1Value + y2Value + pre;
					pre = max(pre, x - y1Value - y2Value);
					ans = max(ans, now);
				}
			}
		}
	}
	cout << ans << endl;
}

int main() {
	while (scanf("%d", &N) != EOF) {
		if (N == 0) {
			break;
		}
		work();
	}
	return 0;
}
